import { defineStore } from 'pinia'

export const homeStore = defineStore({
  id: 'home-store',
  state: () => {
    return {
      count: 0
    }
  },
  getters: {
    double: state => {
      return state.count * 2
    }
  },
  actions: {
    increment() {
      this.count++
    },
    asyncIncrement(num = 1) {
      setTimeout(() => {
        this.count += num
      }, 2000)
    }
  }
})
